forked from External/greenlight
use route url helpers instead of hardcoding
This commit is contained in:
parent
16a1626130
commit
7873f640bc
|
@ -22,7 +22,7 @@ class SessionsController < ApplicationController
|
|||
def create
|
||||
@user = User.from_omniauth(request.env['omniauth.auth'])
|
||||
session[:user_id] = @user.id
|
||||
redirect_to @user.room_url
|
||||
redirect_to meeting_room_url(resource: 'rooms', id: @user.encrypted_id)
|
||||
rescue => e
|
||||
logger.error "Error authenticating via omniauth: #{e}"
|
||||
redirect_to root_path
|
||||
|
|
|
@ -43,10 +43,6 @@ class User < ApplicationRecord
|
|||
auth_hash['info']['email']
|
||||
end
|
||||
|
||||
def room_url
|
||||
"#{Rails.configuration.relative_url_root}/rooms/#{encrypted_id}"
|
||||
end
|
||||
|
||||
def set_encrypted_id
|
||||
self.encrypted_id = "#{username[0..1]}-#{Digest::SHA1.hexdigest(uid+provider)[0..7]}"
|
||||
end
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
<% if current_user %>
|
||||
<div class="text-center">
|
||||
<% if @main_room %>
|
||||
<span><%= t('logged_in_description_html', link: link_to(current_user.name, current_user.room_url)) %></span>
|
||||
<span><%= t('logged_in_description_html', link: link_to(current_user.name, meeting_room_url(resource: 'rooms', id: current_user.encrypted_id))) %></span>
|
||||
<% else %>
|
||||
<%= link_to(t('return_to_room'), current_user.room_url) %>
|
||||
<%= link_to(t('return_to_room'), meeting_room_url(resource: 'rooms', id: current_user.encrypted_id)) %>
|
||||
<% end %>
|
||||
<div><%= link_to t('logout'), user_logout_url %></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue