1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-16 01:55:07 +01:00
onion/js/components/coa_verify_container.js

103 lines
3.7 KiB
JavaScript
Raw Normal View History

2015-06-25 14:39:39 +02:00
'use strict';
import React from 'react';
import Router from 'react-router';
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';
import apiUrls from '../constants/api_urls';
import { getLangText } from '../utils/lang_utils';
2015-06-25 14:39:39 +02:00
let CoaVerifyContainer = React.createClass({
mixins: [Router.Navigation],
render() {
return (
<div className="ascribe-login-wrapper">
<br/>
<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>
<CoaVerifyForm />
<br />
<br />
2015-07-03 19:08:56 +02: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({
mixins: [Router.Navigation],
handleSuccess(response){
let notification = null;
2015-07-08 10:15:58 +02:00
if (response.verdict) {
notification = new GlobalNotificationModel(getLangText('Certificate of Authenticity successfully verified'), 'success');
2015-06-25 14:39:39 +02:00
GlobalNotificationActions.appendGlobalNotification(notification);
}
},
render() {
return (
<div>
<Form
url={apiUrls.coa_verify}
handleSuccess={this.handleSuccess}
buttons={
<button
type="submit"
className="btn ascribe-btn ascribe-btn-login">
2015-07-03 19:08:56 +02:00
{getLangText('Verify your Certificate of Authenticity')}
2015-06-25 14:39:39 +02:00
</button>}
spinner={
<span className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
2015-06-25 14:39:39 +02:00
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
</span>
2015-06-25 14:39:39 +02:00
}>
<Property
name='message'
2015-07-03 19:08:56 +02:00
label={getLangText('Message')}>
2015-06-25 14:39:39 +02:00
<input
type="text"
2015-07-03 19:08:56 +02:00
placeholder={getLangText('Copy paste the message on the bottom of your Certificate of Authenticity')}
2015-06-25 14:39:39 +02:00
autoComplete="on"
name="username"
required/>
</Property>
<Property
name='signature'
label="Signature">
<InputTextAreaToggable
rows={3}
editable={true}
2015-07-03 19:08:56 +02:00
placeholder={getLangText('Copy paste the signature on the bottom of your Certificate of Authenticity')}
2015-06-25 14:39:39 +02:00
required/>
</Property>
<hr />
</Form>
</div>
);
}
});
2015-07-03 19:08:56 +02:00
export default CoaVerifyContainer;