有什么建议办理密码为新的Facebook在用户签名吗? [英] what is recommended for handling password for new Facebook signed in users?

查看:186
本文介绍了有什么建议办理密码为新的Facebook在用户签名吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当可以让用户在使用拍,我第一次创建身份验证后新色器件的用户,问题是什么是更好的做法对新创建的用户的密码怎么办?

When let users sign in using Facebook, I create a new devise user after first authentication, the question is what is the better practice to do regarding the password of newly created user ?

1。用随机令牌补吗?

那么,如何将用户知道新创建的密码?

Then, how would the user know the newly created password ?

一个。要我给他发电子邮件?结果
  湾写它作为他的第一个Facebook的身份验证后,即显信息
  ?

a. Shall I send him an email?
b. Write it as a flash message after his first Facebook authentication ?

我知道,用户可能并不需要有一个密码,因为他总能与Facebook登录,但是,他可能需要更新他的色器件的用户领域,这将需要密码。

2。它留空?

那么,任何一个知道的电子邮件就可以登录使用色器件
  登录表单。

Then, any one know the email will be able to sign in using the devise sign in form.

3。显示模式窗口询问密码?

这样做,它会增加一个步骤之前,用户可以最终访问
  网站。

Doing so, it will add a step before user can eventually access the website.

那么,有什么建​​议的方法?任何意见?

So, what's the recommended approach? any advise?

修改

莱恩·贝茨上RailsCasts
http://railscasts.com/episodes/236-omniauth-part-2 ?查看= asciicast

Ryan Bates on RailsCasts at http://railscasts.com/episodes/236-omniauth-part-2?view=asciicast

将用户重定向到一个表单,如果想保存新用户验证失败,他们可以解决任何问题,他避免渲染密码字段全新的用户:

redirect the user to a form where they can fix any problems if the validation fails when trying to save the new user, he avoided rendering passwords fields for brand-new users:

<h2>Sign up</h2>

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
  <%= devise_error_messages! %>

  <p><%= f.label :email %><br />
  <%= f.text_field :email %></p>

<% if @user.password_required? %>
  <p><%= f.label :password %><br />
  <%= f.password_field :password %></p>

  <p><%= f.label :password_confirmation %><br />
  <%= f.password_field :password_confirmation %></p>
<% end %>
  <p><%= f.submit "Sign up" %></p>
<% end %>

<%= render :partial => "devise/shared/links" %>

但是,当OmniAuth注册的用户尝试登录使用设计注册会怎样?

But, what will happen when a OmniAuth registered user try sign in using devise sign in ?

推荐答案

瑞安·贝茨这涉及对RailsCasts并建议您将它们重定向到一个网页,他们已经与他们的OAuth的帐户登录后。

Ryan Bates covered this on RailsCasts and suggests you redirect them to a page after they've signed up with their oauth account.

这样你仍然可以注册以正常方式的用户,再加上你是窗台验证模型。

This way you can still register users in the normal way plus you're sill validating the model.

我们这样做是出于客户可以注册不同的供应商,仍然保持了色器件的注册到位。

We do this so out customers can sign up with different providers and still keep our devise registration in place.

对此有阅读:

http://railscasts.com/episodes/236-omniauth-部分2?查看= asciicast

如果这不是有益的,让我知道,我会看看我们还有什么可以为您找到

If that's not helpful, let me know and I'll see what else we can find for you

这篇关于有什么建议办理密码为新的Facebook在用户签名吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆