baba_mmx Posted April 17, 2015 Posted April 17, 2015 (edited) Hi, first of all I'd like to thank you all, and in particular Ryan, for this great project which is ProcessWire. I'm using ProcessWire for the first time and frankly I'm finding it quite good, despite my lack of experience. Anyway, I created this post to introduce you the following module, on which we are working, and I'd like to share it with the community which could benefit from it and maybe improve it. You can find the module here: https://bitbucket.org/mauro_mascia/processwire-social-login/ Basically, it adds the ability to allow a social login (using the HybridAuth library - https://github.com/hybridauth/hybridauth) as well as a standard login, user profile and registration. The module is clearly not complete and it is at its first stage of maturity and I hope you can forgive me if I have not fully complied with the PW best practices Edited April 18, 2015 by LostKobrakai Moved to modules forum and updated tags to be appropriate for the subforum 19
Ivan Gretsky Posted April 17, 2015 Posted April 17, 2015 Nice start man) Everyone starting on The Forum with a module should get a free candy . I know nothing about what it is, but if it'll do what you say it's a great thing.
horst Posted April 17, 2015 Posted April 17, 2015 Very nice start! I saw this and before I go on with viewing the module and forget to tell you, you need to specify the version number as integer: 1 or as string "0.0.1". Using 001 will lead in complications with modules upgrades, modules manager etc.
Beluga Posted April 18, 2015 Posted April 18, 2015 Cool! This might come in handy on a non-profit site I'm working on. Lots of PW-heads were working on HybridAuth integration, but a fully functional module was not produced yet.
baba_mmx Posted April 18, 2015 Author Posted April 18, 2015 Thanks dudes. I've fixed the version number. Now a couple of informations: in the providers config file can be specified all providers supported by HybridAuth. For now we have enabled and tested just Facebook and Twitter, and enabled Google but not tested yet (but if it works for "i" and i+1 it should work also for i+N). Each provider will be shown as collapsed fieldset, if not enabled, to save space. Attached, there is a picture of this. This configuration file is used for: create the module edit section (as shown in the above picture) show enabled providers in the login form (see) retrieve info to be processed when the user is doing a login with a certain provider (see) Naturally more providers can be added, following the structure of the returned array. 2
cstevensjr Posted April 18, 2015 Posted April 18, 2015 (it seems that I can't post images) Go to the "More Reply Options" button (which is to the right of the Post button) 2
bernhard Posted April 18, 2015 Posted April 18, 2015 hi baba_mmx, very cool! cstevensjr was faster with the images: https://processwire.com/talk/topic/8597-best-way-to-get-random-quote-displayed-on-refresh/?p=83195 is it a good idea to post your app id and secret? don't know how they are used and if anybody can misuse them? your version number is still 002 and not 2 'version' => 2, don't know what could be the problems but i'm trusting horst and the ryan's helloworld module
baba_mmx Posted April 18, 2015 Author Posted April 18, 2015 Ok here we are - fixed version number. Thanks cstevensjr, done. @BernhardB - don't worry APP ID/Secret are fakes 3
LostKobrakai Posted April 18, 2015 Posted April 18, 2015 your version number is still 002 and not 2 'version' => 2, don't know what could be the problems but i'm trusting horst and the ryan's helloworld module Numbers preceded by a 0 are parsed by php as octal numbers (base 8). var_dump(013); // outputs int(11), because it's 1*8 + 3 1
bernhard Posted April 18, 2015 Posted April 18, 2015 thanks! http://php.net/manual/de/language.types.integer.php
baba_mmx Posted April 21, 2015 Author Posted April 21, 2015 Added registration with confirmation email and activation link I've mainly followed this thread https://processwire.com/talk/topic/4066-activate-user-account-via-email/ The user who registers is created with the unpublished status: $new_user->addStatus( Page::statusUnpublished ); and when she/he clicks on the confirmation link received via email the status turns published: $activate_userid = $this->sanitizer->text( $this->input->get->userid ); $activate_hash = $this->sanitizer->text( $this->input->get->hash ); $this_user = $this->wire('pages')->find( "template=user,id=$activate_userid, include=all" )->first(); if ( is_object( $this_user ) && isset( $this_user->id ) ) { if ( strcmp( $this_user->activation_key, $activate_hash ) == 0 && $this_user->is( Page::statusUnpublished ) ) { echo __( "Thank you! Your account has been activated!" ); $activate_user = $this_user; $activate_user->of(false); $activate_user->activation_key = "0"; $activate_user->removeStatus( Page::statusUnpublished ); $activate_user->save(); } } In the attached pic the configuration page which allows to specify email's fields. As a side note, I've initially tried to get the user with his username: $this->wire( 'users' )->find( "name=$activate_username, include=unpublished" ); but the returned object was really complex and completely protected, so I've changed the behaviour using the user's id. 4
Pete Posted July 12, 2015 Posted July 12, 2015 I keep meaning to comment on this topic as it's something that interests me but I've been so busy lately (and not fun busy unfortunately). I've been looking to do something like this for a while so thanks for saving me some effort Just a few thoughts on future functionality - I know the forums here allow Twitter and Facebook logins and you can link both to a normal account too (I have my Twitter and FB linked to this account). It gets a bit tricky, but it would make sense at some point if you can associate other provider logins with the same PW account. The easiest check I guess would be if the email address stored for the provider account already matched a PW account on the site, so after authenticating at Google for example, it things "well there's an account here already with the same address - let's ask the user if they want to link them rather than create a new profile and ask them for their existing account's password to continue". I know, it's not exactly straightforward and it's more work, but if you get all your accounts linked together nicely you can then start thinking about other functionality like pushing updates to all of those providers through your PW site. Fun stuff!
Beluga Posted July 20, 2015 Posted July 20, 2015 Why is output buffering used in the templates? I have output buffering enabled, but I get completely blank pages, if I visit register or social-login.
OrganizedFellow Posted November 12, 2015 Posted November 12, 2015 VERY cool. Coming in handy soon with a new project
jacmaes Posted March 12, 2016 Posted March 12, 2016 @baba_mmx Any chance to make your module compatible with PW 3x? I would love to try it but it creates an internal server error when trying to login or register.
baba_mmx Posted March 12, 2016 Author Posted March 12, 2016 Unfortunately at the moment I'm unable to work on this. Maybe someone in the forum can take it under his wing?
gunter Posted March 20, 2016 Posted March 20, 2016 Who can help please?This is the problem that I have with Processwire 3.12 and the module SocialLogin...this line does not work! (Error: Class 'ProcessProfile' not found ) class SocialLoginProcessProfile extends ProcessProfile { does it has to do with the new namespace thing in processwire 3.x? <?php namespace ProcessWire; /** * ProcessWire Self Profile * * ProcessWire 3.x (development), Copyright 2015 by Ryan Cramer * https://processwire.com * * * @property array $profileFields Names of fields user is allowed to edit in their profile * */ class ProcessProfile extends Process implements ConfigurableModule, WirePageEditor { public static function getModuleInfo() { return array( 'title' => __('User Profile', __FILE__), // getModuleInfo title 'summary' => __('Enables user to change their password, email address and other settings that you define.', __FILE__), // getModuleInfo summary 'version' => 101, 'permanent' => true, 'permission' => 'profile-edit', ); }
jacmaes Posted March 22, 2016 Posted March 22, 2016 Yep, we need a good and gifted soul to pick up this project and make it compatible with PW 3x. Or it could be extended to be the next Pro module (hint, hint, Ryan )
baba_mmx Posted March 22, 2016 Author Posted March 22, 2016 Hi, next week I'll take some time off and I'll check for that problem 3
gunter Posted March 22, 2016 Posted March 22, 2016 That would be so nice from you!You other guys could try if it works for you, if you comment out these lines in the code!For me this error is gone... (of course you cannot show your profile...) public function showProfile() { // require_once( "classes/SocialLoginProcessProfile.php" ); // $SocialLoginProcessProfile = new SocialLoginProcessProfile( $this->enabled_profile_user_fields ); // $SocialLoginProcessProfile->process(); } but I have now a google uri mismatch error..google told me this uri is wrong:http://terminio.at//en/social-login/?hybridauth=login&hauth.done=Googlebut I added it at my google credentials...I don´t understand why this can be wrong...
DaveP Posted March 23, 2016 Posted March 23, 2016 Looks as if you have an entity encoded ampersand in there - terminio.at//en/social-login/?hybridauth=login&hauth.done=Google <edit> and a double slash (.at//en) </edit> 1
blacksrv Posted September 21, 2016 Posted September 21, 2016 just tested with 2.8, not working for me.
dotnetic Posted December 15, 2016 Posted December 15, 2016 On 12.3.2016 at 6:56 PM, baba_mmx said: Unfortunately at the moment I'm unable to work on this. Maybe someone in the forum can take it under his wing? Been there done that. I proudly present a ProcessWire 3 compatible version with the latest HybridAuth (only tested with Facebook). The code can be found on Github https://github.com/jmartsch/processwire-social-login with installation instructions. Please add your suggestions or create pull requests. The module and its dependencies are installed via composer. Have phun! 9
dotnetic Posted December 24, 2016 Posted December 24, 2016 Hey guys, hey @baba_mmx I just released a new version of this module on github. I also got a question, as I am planning to take this project under my wing: Should I make a new thread for it and add it to the modules directory? @baba_mmx would that be ok with you? One problem is that if I put it in the ProcessWire Modules directory it does not install it dependencies, as they are installed via composer. How could I handle this? What has been done in the latest release? v0.9.1 made the register form public so you can alter the markup and classes added Foundation classes for the errors and notices. Have to make this configurable added new function showMessage to echo messages and errors login user after successful registration removed automatic redirect enabled autocompletion for the form show either displayName from OAuth or email address after login added the ability to save the last name, first name and gender from OAuth in the user profile. Just add the fields "lastName", "firstName" and "gender" to the user template in ProcessWire 4
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now