2015-06-25 14:39:39 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import GlobalNotificationModel from '../models/global_notification_model';
|
|
|
|
import GlobalNotificationActions from '../actions/global_notification_actions';
|
|
|
|
|
|
|
|
import Form from './ascribe_forms/form';
|
|
|
|
import Property from './ascribe_forms/property';
|
|
|
|
import InputTextAreaToggable from './ascribe_forms/input_textarea_toggable';
|
|
|
|
|
2015-10-12 17:55:02 +02:00
|
|
|
import AscribeSpinner from './ascribe_spinner';
|
|
|
|
|
2015-08-07 15:08:02 +02:00
|
|
|
import ApiUrls from '../constants/api_urls';
|
2015-07-01 18:58:13 +02:00
|
|
|
import { getLangText } from '../utils/lang_utils';
|
2015-10-13 16:42:40 +02:00
|
|
|
import { setDocumentTitle } from '../utils/dom_utils';
|
2015-06-25 14:39:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
let CoaVerifyContainer = React.createClass({
|
2015-12-08 18:17:08 +01:00
|
|
|
propTypes: {
|
|
|
|
location: React.PropTypes.object
|
|
|
|
},
|
|
|
|
|
2015-06-25 14:39:39 +02:00
|
|
|
render() {
|
2015-12-09 15:56:47 +01:00
|
|
|
const { message, signature } = this.props.location.query;
|
2015-10-13 16:42:40 +02:00
|
|
|
setDocumentTitle(getLangText('Verify your Certificate of Authenticity'));
|
2015-12-09 15:56:47 +01:00
|
|
|
|
2015-06-25 14:39:39 +02:00
|
|
|
return (
|
|
|
|
<div className="ascribe-login-wrapper">
|
2016-01-29 11:20:43 +01:00
|
|
|
<br />
|
2015-06-25 14:39:39 +02:00
|
|
|
<div className="ascribe-login-text ascribe-login-header">
|
2015-07-03 19:08:56 +02:00
|
|
|
{getLangText('Verify your Certificate of Authenticity')}
|
2015-06-25 14:39:39 +02:00
|
|
|
</div>
|
|
|
|
|
2015-12-09 15:56:47 +01:00
|
|
|
<CoaVerifyForm
|
|
|
|
message={message}
|
|
|
|
signature={signature}/>
|
2015-06-25 14:39:39 +02:00
|
|
|
<br />
|
|
|
|
<br />
|
2016-01-29 11:20:43 +01:00
|
|
|
{getLangText('ascribe is using the following public key for verification')}:
|
2015-06-25 14:39:39 +02:00
|
|
|
<br />
|
|
|
|
<pre>
|
|
|
|
-----BEGIN PUBLIC KEY-----
|
|
|
|
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDddadqY31kKPFYk8PQA8BWSTbm
|
|
|
|
gaGf9KEYBALp2nWAJcwq80qBzGF+gfi0Z+yb4ooeKHl27GnuxZYValE1Z5ZujfeJ
|
|
|
|
TgO4li59ZMYiah8oXZp/OysrBwCvWw0PtWd8/D9Nc4PqyOz5gzEh6kFah5VsuAke
|
|
|
|
Znu2w7KmeLZ85SmwEQIDAQAB
|
|
|
|
-----END PUBLIC KEY-----
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let CoaVerifyForm = React.createClass({
|
2015-12-08 18:17:08 +01:00
|
|
|
propTypes: {
|
2015-12-09 15:56:47 +01:00
|
|
|
message: React.PropTypes.string,
|
|
|
|
signature: React.PropTypes.string
|
2015-12-08 18:17:08 +01:00
|
|
|
},
|
|
|
|
|
2015-06-25 14:39:39 +02:00
|
|
|
handleSuccess(response){
|
2015-07-08 10:15:58 +02:00
|
|
|
if (response.verdict) {
|
2016-01-29 11:20:43 +01:00
|
|
|
const notification = new GlobalNotificationModel(getLangText('Certificate of Authenticity successfully verified'), 'success');
|
2015-06-25 14:39:39 +02:00
|
|
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
2015-12-09 15:56:47 +01:00
|
|
|
const { message, signature } = this.props;
|
|
|
|
|
2015-06-25 14:39:39 +02:00
|
|
|
return (
|
2016-01-29 11:20:43 +01:00
|
|
|
<Form
|
|
|
|
url={ApiUrls.coa_verify}
|
|
|
|
handleSuccess={this.handleSuccess}
|
|
|
|
buttons={
|
|
|
|
<button
|
|
|
|
type="submit"
|
|
|
|
className="btn btn-default btn-wide">
|
|
|
|
{getLangText('Verify your Certificate of Authenticity')}
|
|
|
|
</button>
|
|
|
|
}
|
|
|
|
spinner={
|
|
|
|
<span className="btn btn-default btn-wide btn-spinner">
|
|
|
|
<AscribeSpinner color="dark-blue" size="md" />
|
|
|
|
</span>
|
|
|
|
}>
|
|
|
|
<Property
|
|
|
|
name='message'
|
|
|
|
label={getLangText('Message')}>
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
placeholder={getLangText('Copy paste the message on the bottom of your Certificate of Authenticity')}
|
|
|
|
autoComplete="on"
|
|
|
|
defaultValue={message}
|
|
|
|
required />
|
|
|
|
</Property>
|
|
|
|
<Property
|
|
|
|
name='signature'
|
|
|
|
label="Signature"
|
|
|
|
editable={true}
|
|
|
|
overrideForm={true}>
|
|
|
|
<InputTextAreaToggable
|
|
|
|
rows={3}
|
|
|
|
placeholder={getLangText('Copy paste the signature on the bottom of your Certificate of Authenticity')}
|
|
|
|
defaultValue={signature}
|
|
|
|
required />
|
|
|
|
</Property>
|
|
|
|
<hr />
|
|
|
|
</Form>
|
2015-06-25 14:39:39 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-07-03 19:08:56 +02:00
|
|
|
export default CoaVerifyContainer;
|