onelogin 1.3.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/git-secrets-public.yml +55 -0
  3. data/README.md +64 -0
  4. data/examples/Gemfile.lock +10 -6
  5. data/examples/another-get-all-login-events-of-last-day-to-csv.rb +141 -0
  6. data/examples/events-to-csv.rb +3 -3
  7. data/examples/get-all-login-events-of-last-day-to-csv.rb +88 -0
  8. data/examples/rails-custom-login-page/Gemfile +2 -2
  9. data/examples/rails-custom-login-page/Gemfile.lock +20 -16
  10. data/examples/rails-custom-login-page/README.md +35 -2
  11. data/examples/rails-custom-login-page/app/assets/stylesheets/application.css +1 -61
  12. data/examples/rails-custom-login-page/app/controllers/home_controller.rb +1 -0
  13. data/examples/rails-custom-login-page/app/controllers/sessions_controller.rb +4 -4
  14. data/examples/rails-custom-login-page/app/controllers/users_controller.rb +48 -14
  15. data/examples/rails-custom-login-page/app/helpers/sessions_helper.rb +1 -1
  16. data/examples/rails-custom-login-page/app/helpers/users_helper.rb +1 -0
  17. data/examples/rails-custom-login-page/app/views/dashboard/index.html.erb +2 -9
  18. data/examples/rails-custom-login-page/app/views/home/index.html.erb +84 -18
  19. data/examples/rails-custom-login-page/app/views/layouts/application.html.erb +13 -1
  20. data/examples/rails-custom-login-page/app/views/users/edit.html.erb +30 -24
  21. data/examples/rails-custom-login-page/app/views/users/index.html.erb +30 -27
  22. data/examples/rails-custom-login-page/app/views/users/new.html.erb +58 -3
  23. data/examples/rails-custom-login-page/app/views/users/onboard.html.erb +54 -0
  24. data/examples/rails-custom-login-page/app/views/users/show.html.erb +16 -13
  25. data/examples/rails-custom-login-page/config/initializers/onelogin.rb +3 -1
  26. data/examples/rails-custom-login-page/config/routes.rb +4 -0
  27. data/examples/rails-custom-login-page/config/secrets.yml.sample +2 -0
  28. data/lib/onelogin/api/client.rb +682 -10
  29. data/lib/onelogin/api/cursor.rb +4 -3
  30. data/lib/onelogin/api/models/connector_basic.rb +20 -0
  31. data/lib/onelogin/api/models/event.rb +6 -1
  32. data/lib/onelogin/api/models/event_type.rb +2 -2
  33. data/lib/onelogin/api/models/mfa_token.rb +18 -0
  34. data/lib/onelogin/api/models/onelogin_app.rb +62 -0
  35. data/lib/onelogin/api/models/onelogin_app_basic.rb +51 -0
  36. data/lib/onelogin/api/models/onelogin_app_v1.rb +22 -0
  37. data/lib/onelogin/api/models/user.rb +1 -1
  38. data/lib/onelogin/api/models.rb +5 -0
  39. data/lib/onelogin/api/util/constants.rb +18 -0
  40. data/lib/onelogin/version.rb +1 -1
  41. data/onelogin.gemspec +2 -2
  42. metadata +16 -7
@@ -1,7 +1,7 @@
1
1
  class SessionsController < ApplicationController
2
2
  def new
3
3
  response = log_in(params['username'], params['password'])
4
- status = response ? :ok : :unauthorized
4
+ status = response[:error] ? :unauthorized : :ok
5
5
 
6
6
  render json: response, status: status
7
7
  end
@@ -17,7 +17,7 @@ class SessionsController < ApplicationController
17
17
  # available to verify token before
18
18
  # password reset is completed
19
19
  def forgot_password
20
- user = validate_user(params['username'])
20
+ user = validate_user(params['forgot_username'])
21
21
 
22
22
  devices = get_mfa_devices(user.id)
23
23
 
@@ -28,9 +28,9 @@ class SessionsController < ApplicationController
28
28
 
29
29
  # Verify MFA token and then update password
30
30
  def reset_password
31
- if verify_token(params['device_id'], params['otp_token'])
31
+ if verify_token(params['reset_device_id'], params['reset_otp_token'])
32
32
  status = :ok
33
- response = set_password(session[:user_id], params['password'])
33
+ response = set_password(session[:user_id], params['new_password'])
34
34
  else
35
35
  status = :unauthorized
36
36
  response = 'Invalid token'
@@ -1,6 +1,6 @@
1
1
  class UsersController < ApplicationController
2
2
 
3
- before_action :require_current_user
3
+ before_action :require_current_user, except: [:new, :create, :onboard, :activate]
4
4
  before_action :set_user, only: [:show, :edit, :update, :destroy]
5
5
 
6
6
  # GET /users
@@ -16,7 +16,6 @@ class UsersController < ApplicationController
16
16
 
17
17
  # GET /users/new
18
18
  def new
19
- @user = User.new
20
19
  end
21
20
 
22
21
  # GET /users/1/edit
@@ -26,17 +25,52 @@ class UsersController < ApplicationController
26
25
  # POST /users
27
26
  # POST /users.json
28
27
  def create
29
- @user = User.new(user_params)
28
+ # Create a user
29
+ user = api_client.create_user(user_params)
30
+ # Update custom attributes
31
+ api_client.set_custom_attribute_to_user(user.id, custom_user_params)
32
+ # Set status to unactivated
33
+ api_client.update_user(user.id, status: 0)
30
34
 
31
- respond_to do |format|
32
- if @user.save
33
- format.html { redirect_to @user, notice: 'User was successfully created.' }
34
- format.json { render :show, status: :created, location: @user }
35
- else
36
- format.html { render :new }
37
- format.json { render json: @user.errors, status: :unprocessable_entity }
38
- end
35
+ if api_client.error
36
+ puts api_client.error_description
37
+ end
38
+
39
+ redirect_to onboard_path, notice: 'User has been created with status set to unactivated'
40
+ end
41
+
42
+ # GET /onboard
43
+ def onboard
44
+ end
45
+
46
+ # POST /activate
47
+ def activate
48
+ # Search for a user with this email address
49
+ @user = api_client.get_users(email: user_params[:email]).first
50
+
51
+ unless @user && verify_dob && verify_ssn
52
+ return redirect_to onboard_path, notice: "User #{user_params[:email]} was not verified"
53
+ end
54
+
55
+ # Update password
56
+ unless api_client.set_password_using_clear_text(@user.id, user_params[:password], user_params[:password])
57
+ return redirect_to onboard_path, notice: "Password update failed. #{api_client.error_description}"
39
58
  end
59
+
60
+ # Activate user
61
+ api_client.update_user(@user.id, status: 1)
62
+
63
+ # Redirect to login page
64
+ redirect_to home_index_path
65
+ end
66
+
67
+ # Verify dob and ssn match
68
+ def verify_ssn
69
+ @user.custom_attributes["custom_ssn"].eql? (custom_user_params[:custom_ssn])
70
+ end
71
+
72
+ def verify_dob
73
+ @user.custom_attributes["custom_dob"].eql? (custom_user_params[:custom_dob])
40
74
  end
41
75
 
42
76
  # PATCH/PUT /users/1
@@ -70,17 +104,17 @@ class UsersController < ApplicationController
70
104
  end
71
105
 
72
106
  private
73
- # Use callbacks to share common setup or constraints between actions.
107
+
74
108
  def set_user
75
109
  @user = api_client.get_user(params[:id])
76
110
  end
77
111
 
78
112
  # Never trust parameters from the scary internet, only allow the white list through.
79
113
  def user_params
80
- params.permit(:firstname, :lastname, :email, :phone, :custom_field)
114
+ params.permit(:firstname, :lastname, :email, :phone, :username, :password)
81
115
  end
82
116
 
83
117
  def custom_user_params
84
- params.permit(:custom_field)
118
+ params.permit(:custom_field, :custom_dob, :custom_ssn)
85
119
  end
86
120
  end
@@ -8,7 +8,7 @@ module SessionsHelper
8
8
  },
9
9
  request.base_url # included for CORS session cookie request
10
10
  )
11
- return nil unless response
11
+ return { error: api_client.error_description } unless response
12
12
 
13
13
  if response.is_a? OneLogin::Api::Models::SessionTokenMFAInfo
14
14
  session[:state_token] = response.state_token
@@ -1,2 +1,3 @@
1
1
  module UsersHelper
2
+
2
3
  end
@@ -14,8 +14,9 @@
14
14
  <div class="col-sm">
15
15
  <h2>Apps</h2>
16
16
  <ul class="list-group">
17
+ <% url_base = CUSTOM_DOMAIN || ONELOGIN_SUBDOMAIN + ".onelogin.com" %>
17
18
  <%@apps.each do |app|%>
18
- <li class="list-group-item"><a href="https://<%= ONELOGIN_SUBDOMAIN %>.onelogin.com/launch/<%= app.id %>"><%= app.name %></a></li>
19
+ <li class="list-group-item"><a target="_blank" href="https://<%= url_base %>/launch/<%= app.id %>"><%= app.name %></a></li>
19
20
  <%end%>
20
21
  </ul>
21
22
  </div>
@@ -40,11 +41,3 @@
40
41
  </div>
41
42
  </div>
42
43
  </div>
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
@@ -11,6 +11,15 @@
11
11
  <div class="alert alert-danger message" role="alert">
12
12
  </div>
13
13
 
14
+ <% url_base = CUSTOM_DOMAIN || ONELOGIN_SUBDOMAIN + ".onelogin.com" %>
15
+ <% url_create_session = "https://" + url_base + "/session_via_api_token" %>
16
+
17
+ <form action="<%= url_create_session %>" method="post" class="cookie-session-post-form">
18
+ <input type="hidden" id="cookie_session_token" name="session_token" value="">
19
+ <input id="auth_token" type="hidden">
20
+ <button type="submit">Creating Session ...</button>
21
+ </form>
22
+
14
23
  <%= form_tag("/login", method: "post", class: 'login-form') do %>
15
24
  <div class="form-group">
16
25
  <label for="username">Username</label>
@@ -20,7 +29,9 @@
20
29
  <label for="password">Password</label>
21
30
  <%= password_field_tag :password, nil, placeholder: 'Enter Password', class: 'form-control' %>
22
31
  </div>
23
- <button type="submit" class="btn btn-primary">Login</button> or <a href="#" class="forgot">Forgot Password</a>
32
+ <button type="submit" class="btn btn-primary">Login</button>
33
+ <hr/>
34
+ <a href="#" class="forgot">Forgot Password</a> | <a href="/signup">Sign Up</a>
24
35
  <% end %>
25
36
 
26
37
  <%= form_tag("/verify_mfa", method: "post", class: 'mfa-form') do %>
@@ -37,28 +48,30 @@
37
48
 
38
49
  <%= form_tag("/forgot_password", method: "post", class: 'forgot-password-form') do %>
39
50
  <div class="form-group">
40
- <label for="username">Username</label>
41
- <%= text_field_tag :username, nil, placeholder: 'Enter Username', class: 'form-control' %>
51
+ <label for="forgot_username">Username</label>
52
+ <%= text_field_tag :forgot_username, nil, placeholder: 'Enter Username', class: 'form-control' %>
42
53
  </div>
43
54
  <button type="submit" class="btn btn-primary">Reset Password</button> or <a href="/">Login</a>
44
55
  <% end %>
45
56
 
46
57
  <%= form_tag("/reset_password", method: "post", class: 'reset-password-form') do %>
47
58
  <div class="form-group">
48
- <label for="device_id">MFA Device</label>
49
- <%= select_tag :device_id, nil, {:class => 'form-control'} %>
59
+ <label for="reset_device_id">MFA Device</label>
60
+ <%= select_tag :reset_device_id, nil, {:class => 'form-control'} %>
50
61
  </div>
51
62
  <div class="form-group">
52
- <label for="otp_token">Token</label>
53
- <%= text_field_tag :otp_token, nil, placeholder: 'Enter Token', class: 'form-control' %>
63
+ <label for="reset_otp_token">Token</label>
64
+ <%= text_field_tag :reset_otp_token, nil, placeholder: 'Enter Token', class: 'form-control' %>
54
65
  </div>
55
66
  <div class="form-group">
56
- <label for="password">New Password</label>
57
- <%= password_field_tag :password, nil, placeholder: 'Enter New Password', class: 'form-control' %>
67
+ <label for="new_password">New Password</label>
68
+ <%= password_field_tag :new_password, nil, placeholder: 'Enter New Password', class: 'form-control' %>
58
69
  </div>
59
70
  <button type="submit" class="btn btn-primary">Save Password</button>
60
71
  <% end %>
61
72
 
73
+ <form method="POST" action="" id="sp"></form>
74
+
62
75
  </div>
63
76
  <div class="col-sm">
64
77
  </div>
@@ -70,19 +83,42 @@
70
83
 
71
84
  <script type="text/javascript">
72
85
 
73
- var ONELOGIN_SUBDOMAIN = "<%= ONELOGIN_SUBDOMAIN %>"
86
+ var ONELOGIN_SUBDOMAIN = "<%= ONELOGIN_SUBDOMAIN %>";
87
+ var CUSTOM_DOMAIN = "<%= CUSTOM_DOMAIN %>";
88
+ var COOKIE_VIA_POST_FORM = <%= COOKIE_VIA_POST_FORM || false %>;
74
89
 
75
90
  function makeCors(session_token) {
76
91
  var xhr = new XMLHttpRequest();
77
92
  xhr.withCredentials = true;
78
93
  method = "POST";
79
- var url = "https://" + ONELOGIN_SUBDOMAIN + ".onelogin.com/session_via_api_token";
94
+ if (CUSTOM_DOMAIN) {
95
+ var url = "https://" + CUSTOM_DOMAIN + "/session_via_api_token";
96
+ } else {
97
+ var url = "https://" + ONELOGIN_SUBDOMAIN + ".onelogin.com/session_via_api_token";
98
+ }
80
99
  xhr.open(method, url, true);
81
100
  xhr.setRequestHeader("Content-Type", "application/json");
82
101
  body = {"session_token": session_token};
102
+ xhr.onreadystatechange = function () {
103
+ if(xhr.readyState === 4 && xhr.status === 200) {
104
+ if(getUrlParameter("origin")){
105
+ // If there is an origin SP then redirect to it
106
+ redirectToSP()
107
+ } else{
108
+ // Otherwise redirect to the main dashboard
109
+ window.location.href = '/dashboard';
110
+ }
111
+ }
112
+ };
83
113
  xhr.send(JSON.stringify(body));
84
114
  };
85
115
 
116
+ function sendPostForm(session_token){
117
+ $(".cookie-session-post-form").show();
118
+ $("#cookie_session_token").val(session_token);
119
+ $(".cookie-session-post-form").submit();
120
+ }
121
+
86
122
  function showAlert(type, message){
87
123
  $(".message").removeClass("alert-danger").removeClass("alert-success");
88
124
  $(".message").addClass("alert-" + type).text(message).show();
@@ -92,9 +128,32 @@
92
128
  $(".message").hide();
93
129
  }
94
130
 
131
+ function getUrlParameter(sParam) {
132
+ var sPageURL = window.location.search.substring(1),
133
+ sURLVariables = sPageURL.split('&'),
134
+ sParameterName,
135
+ i;
136
+
137
+ for (i = 0; i < sURLVariables.length; i++) {
138
+ sParameterName = sURLVariables[i].split('=');
139
+
140
+ if (sParameterName[0] === sParam) {
141
+ return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
142
+ }
143
+ }
144
+ };
145
+
146
+ function redirectToSP() {
147
+ var origin = getUrlParameter("origin");
148
+ var samlRequest = getUrlParameter("SAMLRequest");
149
+ var url = origin + "&SAMLRequest=" + samlRequest;
150
+ $("#sp").attr("action", url).submit();
151
+ }
152
+
95
153
  $(function(){
96
154
  hideAlert();
97
155
  $(".login-form").show();
156
+ $(".cookie-session-post-form").hide();
98
157
  $(".mfa-form").hide();
99
158
  $(".forgot-password-form").hide();
100
159
  $(".reset-password-form").hide();
@@ -122,14 +181,18 @@
122
181
  $(".login-form").hide();
123
182
  $(".mfa-form").show();
124
183
 
125
- }else{
126
- makeCors(res.session_token);
127
- window.location.href = '/dashboard';
184
+ } else {
185
+ if (typeof COOKIE_VIA_POST_FORM === 'boolean' && COOKIE_VIA_POST_FORM === true) {
186
+ sendPostForm(res.session_token);
187
+ } else {
188
+ makeCors(res.session_token);
189
+ }
128
190
  }
129
191
  },
130
192
  error: function(xhr, status, err) {
131
193
  console.log(err);
132
- showAlert('danger','Login Failed');
194
+ console.log(xhr);
195
+ showAlert('danger', xhr.responseJSON.error);
133
196
  $(".login-form input[type=submit]").removeAttr("disabled");
134
197
  },
135
198
  });
@@ -144,8 +207,11 @@
144
207
  success: function(res, status, xhr) {
145
208
  console.log(res);
146
209
 
147
- makeCors(res.session_token);
148
- window.location.href = '/dashboard';
210
+ if (typeof COOKIE_VIA_POST_FORM === 'boolean' && COOKIE_VIA_POST_FORM === true) {
211
+ sendPostForm(res.session_token);
212
+ } else {
213
+ makeCors(res.session_token);
214
+ }
149
215
  },
150
216
  error: function(xhr, status, err) {
151
217
  console.log(err);
@@ -203,4 +269,4 @@
203
269
  event.preventDefault();
204
270
  });
205
271
  })
206
- </script>
272
+ </script>
@@ -10,8 +10,20 @@
10
10
  </head>
11
11
 
12
12
  <body>
13
+ <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
14
+ <a class="navbar-brand" href="#">OneLogin Ruby SDK Sample</a>
15
+ <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
16
+ <div class="navbar-nav">
17
+ <a class="nav-item nav-link active" href="/">Login</a>
18
+ <a class="nav-item nav-link" href="/signup">Sign Up</a>
19
+ <a class="nav-item nav-link" href="/onboard">Onboard</a>
20
+ </div>
21
+ </div>
22
+ </nav>
23
+
24
+
13
25
  <% flash.each do |key, value| %>
14
- <div class="alert alert-<%= key %>"><%= value %></div>
26
+ <div class="alert alert-warning"><%= value %></div>
15
27
  <% end %>
16
28
 
17
29
  <%= yield %>
@@ -1,27 +1,33 @@
1
- <h1>Editing User</h1>
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="col-sm">
4
+ <p><%= link_to 'Back', users_path %></p>
2
5
 
3
- <%= form_tag update_user_path, method: "patch", class: "edit" do %>
6
+ <h2>Edit User</h2>
4
7
 
5
- <div>
6
- First Name: <input type="text" name="firstname" value="<%= @user.firstname%>">
8
+ <%= form_tag update_user_path, method: "patch", class: "edit" do %>
9
+ <div class="form-group">
10
+ <label for="firstname">First Name</label>
11
+ <input type="text" name="firstname" value="<%= @user.firstname%>" class="form-control">
12
+ </div>
13
+ <div class="form-group">
14
+ <label for="lastname">Last Name</label>
15
+ <input type="text" name="lastname" value="<%= @user.lastname%>" class="form-control">
16
+ </div>
17
+ <div class="form-group">
18
+ <label for="email">Email</label>
19
+ <input type="text" name="email" value="<%= @user.email%>" class="form-control">
20
+ </div>
21
+ <div class="form-group">
22
+ <label for="email">Phone</label>
23
+ <input type="text" name="phone" value="<%= @user.phone%>" class="form-control">
24
+ </div>
25
+ <div class="form-group">
26
+ <label for="email">Custom Field</label>
27
+ <input type="text" name="custom_field" value="<%= @user.custom_attributes['custom_field'] if @user.custom_attributes.present? %>" class="form-control">
28
+ </div>
29
+ <button type="submit" class="btn btn-primary">Save</button>
30
+ <% end %>
31
+ </div>
7
32
  </div>
8
- <div>
9
- Last Name: <input type="text" name="lastname" value="<%= @user.lastname%>">
10
- </div>
11
- <div>
12
- Email: <input type="text" name="email" value="<%= @user.email%>">
13
- </div>
14
- <div>
15
- Phone: <input type="text" name="phone" value="<%= @user.phone%>">
16
- </div>
17
- </div>
18
- <div>
19
- Custom Field: <input type="text" name="custom_field" value="<%= @user.custom_attributes['custom_field']%>">
20
- </div>
21
-
22
- <div class="actions">
23
- <%= submit_tag %>
24
- </div>
25
- <% end %>
26
-
27
- <%= link_to 'Back', users_path %>
33
+ </div>
@@ -1,30 +1,33 @@
1
1
  <p id="notice"><%= notice %></p>
2
2
 
3
- <h1>Users</h1>
3
+ <div class="container">
4
+ <div class="row">
5
+ <div class="col-sm">
6
+ <h2>Users</h2>
7
+ <table class="table">
8
+ <thead>
9
+ <tr>
10
+ <th scope="col">Name</th>
11
+ <th scope="col">Email</th>
12
+ <th scope="col">Phone</th>
13
+ <th scope="col">Custom Field</th>
14
+ <th scope="col" colspan="2"></th>
15
+ </tr>
16
+ </thead>
4
17
 
5
- <table class="table">
6
- <thead>
7
- <tr>
8
- <th scope="col">Name</th>
9
- <th scope="col">Email</th>
10
- <th scope="col">Phone</th>
11
- <th scope="col">Custom Field</th>
12
- <th scope="col" colspan="2"></th>
13
- </tr>
14
- </thead>
15
-
16
- <tbody>
17
- <% @users.each do |user| %>
18
- <tr>
19
- <td scope="row"><%= user.firstname %> <%= user.lastname %></td>
20
- <td><%= user.email %></td>
21
- <td><%= user.phone %></td>
22
- <td><%= user.custom_attributes["custom_field"] if user.custom_attributes.is_a?(Hash) %></td>
23
- <td><%= link_to 'Show', user_path(user.id) %></td>
24
- <td><%= link_to 'Edit', edit_user_path(user.id) %></td>
25
- </tr>
26
- <% end %>
27
- </tbody>
28
- </table>
29
-
30
- <br>
18
+ <tbody>
19
+ <% @users.each do |user| %>
20
+ <tr>
21
+ <td scope="row"><%= user.firstname %> <%= user.lastname %></td>
22
+ <td><%= user.email %></td>
23
+ <td><%= user.phone %></td>
24
+ <td><%= user.custom_attributes["custom_field"] if user.custom_attributes.is_a?(Hash) %></td>
25
+ <td><%= link_to 'Show', user_path(user.id) %></td>
26
+ <td><%= link_to 'Edit', edit_user_path(user.id) %></td>
27
+ </tr>
28
+ <% end %>
29
+ </tbody>
30
+ </table>
31
+ </div>
32
+ </div>
33
+ </div>
@@ -1,5 +1,60 @@
1
- <h1>New User</h1>
1
+ <div class="jumbotron">
2
+ <p>This is a simple demo of how to sign up a new user and then make them activate their account</p>
3
+ </div>
2
4
 
3
- <%= render 'form', user: @user %>
5
+ <div class="container">
6
+ <div class="row">
7
+ <div class="col-sm">
8
+ </div>
9
+ <div class="col-sm">
4
10
 
5
- <%= link_to 'Back', users_path %>
11
+ <div class="alert alert-danger message" role="alert">
12
+ </div>
13
+
14
+ <%= form_tag("/users", method: "post", class: 'signup-form') do %>
15
+ <div class="form-group">
16
+ <label for="firstname">First Name</label>
17
+ <%= text_field_tag :firstname, nil, placeholder: 'First Name', class: 'form-control' %>
18
+ </div>
19
+ <div class="form-group">
20
+ <label for="lastname">Last Name</label>
21
+ <%= text_field_tag :lastname, nil, placeholder: 'Last Name', class: 'form-control' %>
22
+ </div>
23
+ <div class="form-group">
24
+ <label for="email">Email</label>
25
+ <%= text_field_tag :email, nil, placeholder: 'Email Address', class: 'form-control' %>
26
+ </div>
27
+ <div class="form-group">
28
+ <label for="custom_dob">Date of Birth</label>
29
+ <%= text_field_tag :custom_dob, nil, placeholder: 'mm/dd/yyyy', class: 'form-control' %>
30
+ </div>
31
+ <div class="form-group">
32
+ <label for="custom_ssn">Last 4 of SSN</label>
33
+ <%= text_field_tag :custom_ssn, nil, placeholder: 'Last 4 of SSN', class: 'form-control' %>
34
+ </div>
35
+ <button type="submit" class="btn btn-primary">Sign Up</button>
36
+ <hr/>
37
+ <a href="/">Login</a>
38
+ <% end %>
39
+
40
+ </div>
41
+ <div class="col-sm">
42
+ </div>
43
+ </div>
44
+ </div>
45
+
46
+
47
+ <script type="text/javascript">
48
+ function showAlert(type, message){
49
+ $(".message").removeClass("alert-danger").removeClass("alert-success");
50
+ $(".message").addClass("alert-" + type).text(message).show();
51
+ $(".message").show();
52
+ }
53
+ function hideAlert(){
54
+ $(".message").hide();
55
+ }
56
+
57
+ $(function(){
58
+ hideAlert();
59
+ })
60
+ </script>
@@ -0,0 +1,54 @@
1
+ <div class="jumbotron">
2
+ <p>This shows how an unactivated user could supply infomation to complete a sign up flow</p>
3
+ </div>
4
+
5
+ <div class="container">
6
+ <div class="row">
7
+ <div class="col-sm">
8
+ </div>
9
+ <div class="col-sm">
10
+
11
+ <div class="alert alert-danger message" role="alert">
12
+ </div>
13
+
14
+ <%= form_tag("/activate", method: "post", class: 'signup-form') do %>
15
+ <div class="form-group">
16
+ <label for="email">Email</label>
17
+ <%= text_field_tag :email, nil, placeholder: 'Email Address', class: 'form-control' %>
18
+ </div>
19
+ <div class="form-group">
20
+ <label for="custom_dob">Date of Birth</label>
21
+ <%= text_field_tag :custom_dob, nil, placeholder: 'mm/dd/yyyy', class: 'form-control' %>
22
+ </div>
23
+ <div class="form-group">
24
+ <label for="custom_ssn">Last 4 of SSN</label>
25
+ <%= text_field_tag :custom_ssn, nil, placeholder: 'Last 4 of SSN', class: 'form-control' %>
26
+ </div>
27
+ <div class="form-group">
28
+ <label for="password">Password</label>
29
+ <%= password_field_tag :password, nil, placeholder: 'Make up a password', class: 'form-control' %>
30
+ </div>
31
+ <button type="submit" class="btn btn-primary">Activate Account</button>
32
+ <% end %>
33
+
34
+ </div>
35
+ <div class="col-sm">
36
+ </div>
37
+ </div>
38
+ </div>
39
+
40
+
41
+ <script type="text/javascript">
42
+ function showAlert(type, message){
43
+ $(".message").removeClass("alert-danger").removeClass("alert-success");
44
+ $(".message").addClass("alert-" + type).text(message).show();
45
+ $(".message").show();
46
+ }
47
+ function hideAlert(){
48
+ $(".message").hide();
49
+ }
50
+
51
+ $(function(){
52
+ hideAlert();
53
+ })
54
+ </script>
@@ -1,14 +1,17 @@
1
- <p id="notice"><%= notice %></p>
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="col-sm">
4
+ <%= link_to 'Edit', edit_user_path(@user.id) %> |
5
+ <%= link_to 'Back', users_path %>
2
6
 
3
- <%= link_to 'Edit', edit_user_path(@user.id) %> |
4
- <%= link_to 'Back', users_path %>
5
-
6
- <h2>Profile</h2>
7
-
8
- <ul class="list-group">
9
- <%@user.instance_values.symbolize_keys.each do |k, v|%>
10
- <li class="list-group-item">
11
- <b><%= k%>:</b> <%= v%>
12
- </li>
13
- <%end%>
14
- </ul>
7
+ <h2><%= @user.firstname %> <%= @user.lastname %></h2>
8
+ <ul class="list-group">
9
+ <%@user.instance_values.symbolize_keys.each do |k, v|%>
10
+ <li class="list-group-item">
11
+ <b><%= k%>:</b> <%= v%>
12
+ </li>
13
+ <%end%>
14
+ </ul>
15
+ </div>
16
+ </div>
17
+ </div>
@@ -1,4 +1,6 @@
1
1
  ONELOGIN_CLIENT_ID = Rails.application.secrets.ONELOGIN_CLIENT_ID
2
2
  ONELOGIN_CLIENT_SECRET = Rails.application.secrets.ONELOGIN_CLIENT_SECRET
3
3
  ONELOGIN_REGION = Rails.application.secrets.ONELOGIN_REGION
4
- ONELOGIN_SUBDOMAIN = Rails.application.secrets.ONELOGIN_SUBDOMAIN
4
+ ONELOGIN_SUBDOMAIN = Rails.application.secrets.ONELOGIN_SUBDOMAIN
5
+ CUSTOM_DOMAIN = Rails.application.secrets.CUSTOM_DOMAIN
6
+ COOKIE_VIA_POST_FORM = Rails.application.secrets.COOKIE_VIA_POST_FORM