Work towards authentication through opening window

This commit is contained in:
2014-08-18 18:20:58 +02:00
parent bfa6bb66b0
commit 268c5aabb9
8 changed files with 44 additions and 28 deletions
+1 -2
View File
@@ -1,9 +1,8 @@
doctype html
html lang="en"
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"
title= application_title
/ = stylesheet_link_tag 'obtain_token/application'
/ = csrf_meta_tags
+1 -1
View File
@@ -16,7 +16,7 @@ html lang="en"
var $event_host = '#{Qwaiter.event_host}';
var $asset_path = '##assets_path##';
var Qstorage = window.localStorage;
var Qstorage.setItem('root_url', '##root_url##');
Qstorage.setItem('root_url', '##root_url##');
var $platform = '##platform##';
var $obtain_token_url = 'http://mozo.bar/user/obtain_token';
+4 -17
View File
@@ -1,27 +1,14 @@
.row
h1 data-t='obtain_token.title' = t('user.obtain_token.title')
hr
/form
.form-row
.form-label
label.control-label data-t='attributes.user.email' = User.human_attribute_name(:email)
.form-field
input#user-email.email type="email" placeholder=User.human_attribute_name(:email)
.form-row
.form-label
label.control-label data-t='attributes.user.password' Password
.form-field
input#user-password.password type="password" placeholder="Password"
.form-row
.form-label  
.form-field
button.btn.btn-primary data-t="obtain_token.obtain" onclick="Quser.authenticate_user(); return false" = t('user.obtain_token.obtain')
- unless current_user.blank? || ENV['QWAITER_MOBILE_EXPORT']=='yes'
- if current_user.present?
p Waiting for authentication to complete.....
javascript:
Qstorage = window.localStorage;
Qstorage.setItem('auth_token', '#{current_user.authentication_token}');
Qstorage.setItem('user_id', '#{current_user.id}');
window.location = (Qstorage.getItem('root_url') || '/user/index.html') + '?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}';
if(window.opener && window.opener != window) window.close();
// window.location = (Qstorage.getItem('root_url') || '/user/index.html') + '?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}';
// localStorage.setItem('auth_token', '#{current_user.authentication_token}');
// localStorage.setItem('user_id', '#{current_user.id}');
// window.location = $root_url + '?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}';