{"id":19241045,"url":"https://github.com/binocarlos/shadowfax","last_synced_at":"2025-02-23T14:27:49.228Z","repository":{"id":16502155,"uuid":"19255025","full_name":"binocarlos/shadowfax","owner":"binocarlos","description":"angular login/register and general account related directives - works well with gandalf","archived":false,"fork":false,"pushed_at":"2014-10-08T18:18:45.000Z","size":188,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T20:06:02.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binocarlos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-28T21:43:44.000Z","updated_at":"2014-10-07T16:50:15.000Z","dependencies_parsed_at":"2022-08-25T15:02:37.914Z","dependency_job_id":null,"html_url":"https://github.com/binocarlos/shadowfax","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fshadowfax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fshadowfax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fshadowfax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binocarlos%2Fshadowfax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binocarlos","download_url":"https://codeload.github.com/binocarlos/shadowfax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240326683,"owners_count":19783887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T17:09:57.886Z","updated_at":"2025-02-23T14:27:49.204Z","avatar_url":"https://github.com/binocarlos.png","language":"JavaScript","readme":"shadowfax\n=========\n\nangular login/register form directives - works well with [gandalf](https://github.com/binocarlos/gandalf)\n\n## install\n\nInstall the module to your project:\n\n```\n$ npm install shadowfax --save\n```\n\nInclude it in your app.js:\n\n```js\nvar angular = require('angular-bsfy')\nvar shadowfax = require('shadowfax')\n\nvar app = angular.module('myApp',[\n    shadowfax.name\n])\n```\n\nThen compile with [browserify](https://github.com/substack/node-browserify) and [brfs](https://github.com/substack/brfs):\n\n```bash\n$ browserify -t brfs app.js \u003e bundle.js\n```\n\n## usage\n\nShadowfax directives use bootstrap markup - use them inside a controller that includes the shadowfax module.\n\n```js\nvar angular = require('angular-bsfy')\nvar shadowfax = require('shadowfax')\n\nvar app = angular.module('myApp',[\n    shadowfax.name\n])\n\napp.controller('MyCtrl', function($scope){\n\t$scope.$on('shadowfax:login', function($ev, data){\n\t\t// handle login with data.username \u0026 data.password\n\t})\n})\n```\n\nThen you can use shadowfax directives from your pages:\n\n```html\n\u003cbody ng-app=\"MyApp\" ng-controller=\"MyCtrl\"\u003e\n\u003ch3\u003eLogin\u003c/h3\u003e\n\n\u003cdiv\u003e\n\t\u003cshadowfax-login /\u003e\n\u003c/div\u003e\n\n\u003ch3\u003eRegister\u003c/h3\u003e\n\n\u003cdiv\u003e\n\t\u003cshadowfax-register\u003e\n\n\t\t\u003c!--\n\t\t\tYou can transclude extra form items into the register form\n\t\t\tSet the model to be property of data\n\t\t --\u003e\n\t\t\u003cdiv class=\"form-group\"\u003e\n      \u003clabel class=\"col-md-2 control-label\" for=\"extra\"\u003eExtra\u003c/label\u003e\n      \u003cdiv class=\"col-md-8\"\u003e\n        \u003cinput type=\"text\" class=\"form-control\" id=\"extra\" name=\"extra\" placeholder=\"Confirm Password\" ng-model=\"data.extra\" required\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n\n\t\u003c/shadowfax-register\u003e\n\u003c/div\u003e\n\n\u003cscript src=\"build.js\"\u003e\u003c/script\u003e\n\u003c/body\u003e\n```\n\n## directives\n\n#### `shadowfax-login`\n\nShow a login form with username \u0026 password fields.\n\n#### `shadowfax-mini-login`\n\nShow a compact login form with username \u0026 password fields.\n\n#### `shadowfax-register`\n\nShow a register form with username, email \u0026 password fields.\n\nIt will render these fields automatically:\n\n * username\n * email\n * password\n\nThe register directive is transcluded so you can pass extra form fields into it.\n\n#### `shadowfax-details`\n\nShow a details form that is the same as the register form but will update a shadowfax:save event instead.\n\nIt is transcluded like the register form.\n\n## events\n\nListen to these events in the scope to handle the backend logic how you want.\n\n##### `$on('shadowfax:login', function($ev, data){})`\n\nCalled when the `login` button is pressed - data is an object:\n\n```js\n{\n\tusername:\"bob\",\n\tpassword:\"password\"\n}\n```\n\nAn example of hooking up custom logic to deal with the login event:\n\n```js\napp.controller('MyCtrl', function($scope, $http){\n\t$scope.$on('shadowfax:login', function($ev, data){\n\t\t$http({\n\t\t\turl:'/auth/login',\n\t\t\tmethod:'POST',\n\t\t\tdata:data\n\t\t})\n\t\t.success(function(data){\n\t\t\t// user has logged in\n\t\t})\n\t\t.error(function(data){\n\t\t\t// problem\n\t\t})\n\t})\n})\n```\n\n##### `$on('shadowfax:register', function($ev, data){})`\n\nCalled when the `register` button is pressed - data is an object:\n\n```js\n{\n\tusername:\"bob\",\n\tfullname:\"Bob Bob\",\n\temail:\"bob@bob.com\",\n\tpassword:\"password\"\n}\n```\n\nAn example of hooking up custom logic to deal with the login event:\n\n```js\napp.controller('MyCtrl', function($scope, $http){\n\t$scope.$on('shadowfax:register', function($ev, data){\n\t\t$http({\n\t\t\turl:'/auth/register',\n\t\t\tmethod:'POST',\n\t\t\tdata:data\n\t\t})\n\t\t.success(function(data){\n\t\t\t// user has registered\n\t\t})\n\t\t.error(function(data){\n\t\t\t// problem\n\t\t})\n\t})\n})\n```\n\n##### `$on('shadowfax:save', function($ev, data){})`\n\nCalled when the details form is saved - essentially the same as register but used for an existing user to update their details.\n\n## license\n\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinocarlos%2Fshadowfax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinocarlos%2Fshadowfax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinocarlos%2Fshadowfax/lists"}